package com.teame.readbaby.parser;

import java.util.List;

import org.json.JSONException;

import com.alibaba.fastjson.JSONObject;
import com.teame.readbaby.util.Logger;
import com.teame.readbaby.vo.OrderDetail;

public class OrderListParser extends BaseParser<List<OrderDetail>> {

	private static final String TAG = "OrderListParser";

	@Override
	public  List<OrderDetail> parseJSON(String paramString) throws JSONException {
		if (paramString == null) {
			return null;
		}
		String result = checkResponse(paramString);
		if (result == null) {
			Logger.i(TAG, result);
			return null;
		}
		
		JSONObject jsonObject = JSONObject.parseObject(paramString);
		String jsonOrderlist = jsonObject.getString("orderlist");
		List<OrderDetail> orderDetails = JSONObject.parseArray(jsonOrderlist, OrderDetail.class);
		return orderDetails;
	}
}
